<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="group-item">
    <image class="group-item-img" :src="info.group_pic" mode="aspectFill" />
    <view class="group-item-content">
      <view class="group-item-name">{{ info.name }}</view>
      <view style="display: flex; align-items: center">
        <view class="group-item-num">{{ info.join_count }}人已加入</view>
        <image
          class="group-item-user"
          v-for="(i, d) of info.avatar_arr"
          :style="{ marginLeft: d === 0 ? '0' : '' }"
          :key="d"
          :src="i"
          mode="aspectFill"
        />
      </view>
    </view>
  </view>
</template>

<style lang="scss">
.group-item {
  display: flex;
  align-items: center;

  .group-item-img {
    flex-shrink: 0;
    width: 88rpx;
    height: 88rpx;
    border-radius: 10rpx;
  }

  .group-item-content {
    flex-grow: 1;
    min-width: 0;
    margin-left: 10rpx;
  }

  .group-item-name {
    margin-bottom: 16rpx;
    font-size: 28rpx;
    color: #242424;
    line-height: 40rpx;
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .group-item-num {
    margin-right: auto;
    font-size: 22rpx;
    color: #666666;
    line-height: 32rpx;
  }

  .group-item-user {
    margin-left: -16rpx;
    width: 28rpx;
    height: 28rpx;
    border-radius: 50%;
    border: 2rpx solid #ffffff;
  }
}
</style>